package com.example.mpdemo.web.controller;

import com.example.mpdemo.pojo.Concert;
import com.example.mpdemo.service.ConcertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
@RequestMapping("/concert")
public class ConcertController {
    @Autowired
    private ConcertService concertService;

    @GetMapping("/{concertid}")
    public String getConcert(Model model, @PathVariable("concertid") Integer concertid) {
        Concert concert = concertService.getById(concertid);
        model.addAttribute("concert", concert);

        return "demo/view";
    }
}
